package net.factoryOpen.quickfactory.manufacturing.eng.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.factoryOpen.quickfactory.manufacturing.eng.mapper.EngErMapper;
import net.factoryOpen.quickfactory.manufacturing.eng.domain.EngEr;
import net.factoryOpen.quickfactory.manufacturing.eng.service.IEngErService;

import net.factoryOpen.quickfactory.system.mapper.SysBillFrozenMapper;

/**
 * 工艺处理请求Service业务层处理
 * 
 * @author factoryOpen
 * @date 2024-12-12
 */
@Service
public class EngErServiceImpl implements IEngErService 
{
    @Autowired(required = false)
    private EngErMapper engErMapper;

    /**
     * 查询工艺处理请求
     * 
     * @param id 工艺处理请求主键
     * @return 工艺处理请求
     */
    @Override
    public EngEr selectEngErById(Long id)
    {
        return engErMapper.selectEngErById(id);
    }

    /**
     * 查询工艺处理请求列表
     * 
     * @param engEr 工艺处理请求
     * @return 工艺处理请求
     */
    @Override
    public List<EngEr> selectEngErList(EngEr engEr)
    {
        return engErMapper.selectEngErList(engEr);
    }

    /**
     * 新增工艺处理请求
     * 
     * @param engEr 工艺处理请求
     * @return 结果
     */
    @Override
    public int insertEngEr(EngEr engEr)
    {
        engEr.refreshCreatingStamp();
        return engErMapper.insertEngEr(engEr);
    }

    /**
     * 修改工艺处理请求
     * 
     * @param engEr 工艺处理请求
     * @return 结果
     */
    @Override
    public int updateEngEr(EngEr engEr)
    {
        engEr.refreshUpdatingStamp();
        return engErMapper.updateEngEr(engEr);
    }

    /**
     * 批量删除工艺处理请求
     * 
     * @param ids 需要删除的工艺处理请求主键
     * @return 结果
     */
    @Override
    public int deleteEngErByIds(Long[] ids)
    {
        return engErMapper.deleteEngErByIds(ids);
    }

    /**
     * 删除工艺处理请求信息
     * 
     * @param id 工艺处理请求主键
     * @return 结果
     */
    @Override
    public int deleteEngErById(Long id)
    {
        return engErMapper.deleteEngErById(id);
    }

     /**
      * 完成
      *
      * @param engEr 完成
      * @return 结果
      */
     @Override
     public int finish(EngEr engEr){
         Long id = engEr.getId();
         EngEr obj = engErMapper.selectEngErById(id);

         obj.setStatus(11);
         obj.refreshUpdatingStamp();
         return engErMapper.updateEngEr(obj);
     }
}
